#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int arr[10][10] = { 0 };
	int n = 0;
	scanf("%d", &n);
	if (n == 1)
	{
		printf("%3d", 1);
		return 0;
	}
	int left = 0;
	int right = n;
	int up = 0;
	int down = n;
	int x = 0;
	int y = 0;
	int count = 2;
	arr[x][y] = 1;
	while (1)
	{
		while (arr[x][y + 1] == 0 && y < right - 1)
		{
			arr[x][++y] = count++;
		}
		right--;
		while (arr[x + 1][y] == 0 && x < down - 1)
		{
			arr[++x][y] = count++;
		}
		down--;
		while (arr[x][y - 1] == 0 && y > left)
		{
			arr[x][--y] = count++;
		}
		while (arr[x - 1][y] == 0 && x > up)
		{
			arr[--x][y] = count++;
		}
		if (arr[x - 1][y] != 0 && arr[x + 1][y] != 0 && arr[x][y + 1] != 0 && arr[x][y - 1] != 0)
			break;
	}

	int i = 0;
	for (i = 0; i < n; i++)
	{
		int j = 0;
		for (j = 0; j < n; j++)
		{
			printf("%3d", arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}